Here are examples with restrictions on peak heights, valley heights, and run lengths Let a(n) be the number of Motzkin paths of length n The generating function P(x) of the sequence a(n) satisfies the algebraic equation 2 2 P x + P x - P + 1 = 0 Here are the terms a(n) from n=0 to n=100 [1, 1, 2, 4, 9, 21, 51, 127, 323, 835, 2188, 5798, 15511, 41835, 113634, 310572, 853467, 2356779, 6536382, 18199284, 50852019, 142547559, 400763223, 1129760415, 3192727797, 9043402501, 25669818476, 73007772802, 208023278209, 593742784829, 1697385471211, 4859761676391, 13933569346707, 40002464776083, 114988706524270, 330931069469828, 953467954114363, 2750016719520991, 7939655757745265, 22944749046030949, 66368199913921497, 192137918101841817, 556704809728838604, 1614282136160911722, 4684478925507420069, 13603677110519480289, 39532221379621112004, 114956499435014161638, 334496473194459009429, 973899740488107474693, 2837208756709314025578, 8270140811590103129028, 24119587499879368045581, 70380687801729972163737, 205473381836953330090977, 600161698382141668958313, 1753816895177229449263803, 5127391665653918424581931, 14996791899280244858336604, 43881711243248048262611670, 128453535912993825479057919, 376166554620363320971336899, 1101997131244113831001323618, 3229547920421385142120565580, 9468017265749942384739441267, 27766917351255946264000229811, 81459755507915876737297376646, 239056762740830735069669439852, 701774105036927170410592656651, 2060763101398061220299787957807, 6053261625552368838017538638577, 17785981695172350686294020499397, 52274487460035748810950928411209, 153681622703766437645990598724233, 451929928113276686826984901736388, 1329334277731700374912787442584082, 3911184337415864255099077969308357, 11510402374965653734436362305721089, 33882709435158403490429948661355518, 99762777233730236158474945885114348, 293804991106867190838370294149325217, 865461205861621792586606565768282577, 2549948950073051466077548390833960154, 7514646250637159480132421134685515996, 22150145406114764734833589779994282345, 65303054248346999524711654923215773701, 192564948449128362785882746541078077821, 567944426681696509718034692302003744197, 1675395722976475387857861526496400455935, 4943221572052274428484817274841589781103, 14587540897567180436019575590444202957764, 43055804394719442101962182766220627765254, 127103430617648266466982424978107271745123, 375281510930976756310181851730346874521559, 1108229819877900763405338193186744667723583, 3273209089476438052473101825635320104642103, 9669131152389329200998265687814683780583133, 28567321136213468215221364999058944720713501, 84414794291793480358891042199686850901302514, 249478578991224378680142561460010030467811580, 737415571391164350797051905752637361193303669] ---------------------------- Let a(n) be the number of Motzkin paths of length n with the following restrictions No valley height can be in {1} and no upward run can have length in {1} The generating function P(x) of the sequence a(n) satisfies the algebraic equation 3 10 2 9 3 7 3 6 2 7 3 5 2 6 P x + P x + P x - 6 P x - P x + 7 P x + 5 P x 3 4 2 5 6 3 3 2 4 5 + 4 P x - 10 P x - P x - 15 P x - P x + 3 P x 3 2 2 3 4 3 2 2 3 3 + 14 P x + 22 P x - P x - 6 P x - 28 P x - 9 P x + P 2 2 3 2 2 + 15 P x + 17 P x + x - 3 P - 12 P x - 3 x + 3 P + 3 x - 1 = 0 Here are the terms a(n) from n=0 to n=100 [1, 1, 1, 1, 2, 5, 12, 26, 53, 106, 215, 448, 956, 2070, 4517, 9910, 21870, 48600, 108796, 245254, 556320, 1268915, 2908818, 6699175, 15495998, 35990372, 83906246, 196299655, 460731507, 1084618619, 2560443208, 6060085268, 14377757409, 34188637032, 81467762937, 194510831913, 465266185790, 1114831346060, 2675600202572, 6431254743197, 15480823818153, 37314768482853, 90058145102505, 217615868513646, 526448001151408, 1274946247015564, 3090834472300239, 7500406886314486, 18217903594268703, 44289135438599175, 107761411556219041, 262409675444187877, 639486317481397416, 1559562751350461880, 3806106240283294678, 9295067281825877968, 22714629379798394310, 55542943377078470498, 135897524049858145992, 332692901692024711907, 814920706630813061485, 1997183733196620142030, 4897145972593807857922, 12013855727994870237298, 29486858446132405610744, 72405927361846822988777, 177873979160377328731203, 437156472792401678166941, 1074834077803616718504113, 2643748230147021373854644, 6505299950389294341555302, 16013187953569842496739132, 39431785704560090580362870, 97133360917116757216342372, 239353119571959323003043591, 590002778703852493882035761, 1454819415392238990858745610, 3588394204891085248957646391, 8853670699442527961575922928, 21851187266953766931526740087, 53945052285405803856860879837, 133213947547207707489222722353, 329053118016350194453102655285, 813012865955843587710743385826, 2009282066759105354446295455179, 4966993398950591159171157938433, 12281535187830636137999240975781, 30374941484703795874018931581393, 75141417250909423819124863198144, 185926788754251123361110246118222, 460151471098575307466059542032751, 1139078391573218928824942900095902, 2820318383694794935573028987204660, 6984450474891851555689974508784638, 17300308693190964245481358990018268, 42860868534878795713550570197501367, 106206636105258601765893346481842315, 263223126109881154512260949500738390, 652493707817067094535225559207346010, 1617732694486205409107429055820961469, 4011563364240830197917149432885167894] ---------------------------- Let a(n) be the number of Motzkin paths of length n with the following restrictions No peak can have height in {1,2} and no flat run can have length in {1,2} The generating function P(x) of the sequence a(n) satisfies the algebraic equation 2 24 2 22 2 21 2 20 2 19 20 P x - 6 P x + 6 P x + 15 P x - 30 P x + 2 P x 2 18 19 2 17 18 2 16 - 3 P x - 2 P x + 56 P x - 10 P x - 51 P x 17 2 15 16 2 14 15 16 + 20 P x - 16 P x + 10 P x + 72 P x - 60 P x + x 2 13 14 15 2 12 13 14 - 70 P x + 44 P x - 2 x + 23 P x + 48 P x - 3 x 2 11 12 13 2 10 11 + 34 P x - 110 P x + 12 x - 69 P x + 74 P x 12 2 9 10 11 2 8 9 - 6 x + 72 P x + 18 P x - 20 x - 49 P x - 100 P x 10 2 7 8 9 2 6 7 + 34 x + 4 P x + 127 P x - 12 x + 47 P x - 81 P x 8 2 5 6 7 2 4 5 - 25 x - 72 P x - 3 P x + 46 x + 62 P x + 68 P x 6 2 3 4 5 2 2 3 - 41 x - 38 P x - 92 P x + 12 x + 18 P x + 81 P x 4 2 2 3 2 2 + 25 x - 6 P x - 49 P x - 42 x + P + 18 P x + 31 x - 3 P - 12 x + 2 = 0 Here are the terms a(n) from n=0 to n=100 [1, 0, 0, 1, 1, 1, 2, 1, 3, 8, 14, 26, 66, 134, 288, 602, 1297, 2706, 5805, 12235, 26217, 55772, 119955, 257016, 554986, 1196729, 2594162, 5622459, 12231868, 26623076, 58107713, 126925517, 277839680, 608752504, 1336075853, 2935218105, 6457500746, 14220066412, 31351699806, 69185570509, 152835216048, 337911290937, 747794696297, 1656182014944, 3671063768848, 8143230435698, 18076949986508, 40156027364820, 89262910422744, 198548431206566, 441908062063830, 984129701110584, 2192913198090158, 4889080225659310, 10905933832713630, 24339887462615668, 54348516193235134, 121412051329642026, 271352962317322915, 606734516403738626, 1357213818062563583, 3037224269899459545, 6799531056212375762, 15228210219237007444, 34117836348595315369, 76466583970786223639, 171441044546579461432, 384508716349322135596, 862663728901750663444, 1936050289537619134921, 4346378213460192678108, 9760460960855599937813, 21925092163975450134824, 49264862991430287201606, 110727251841485878649119, 248937259588654179853919, 559809576835096128839515, 1259223393460308560159514, 2833181589968231698383803, 6376060616351488603513434, 14352719620745115275353334, 32315965526492012690560571, 72777774907153004400603326, 163936904440140022722349827, 369359021512919254962906299, 832362488386424816454847444, 1876143094527448906628063239, 4229675252764926716821726602, 9537481343908384790210628290, 21510180948088787131133359775, 48521726883154175427894361948, 109473362010369529056980395999, 247035257957738663430572373348, 557552826356346216234062079868, 1258600970799258628820199485724, 2841603529317946461441238975409, 6416685499813778124524349032651, 14492002136468392941468908152481, 32735196476913035054353310676977, 73955256306839409344834855882745, 167104952153869144222867545103844] ---------------------------- Let a(n) be the number of Motzkin paths of length n with the following restrictions No peak can have height in {2}, no valley can have height in {1}, and no upward run can have length in {3} The generating function P(x) of the sequence a(n) satisfies the algebraic equation FAIL Cannot find the equation from the first 101 terms of the sequence Here are the terms a(n) from n=0 to n=100 [1, 1, 2, 4, 8, 16, 32, 66, 142, 318, 739, 1771, 4348, 10871, 27552, 70564, 182267, 474258, 1242201, 3273668, 8677326, 23126235, 61951660, 166759003, 450891963, 1224230617, 3336778233, 9127211023, 25048262355, 68950503340, 190334970716, 526782147354, 1461481071189, 4063788111526, 11323418499104, 31613444710919, 88421624310710, 247734874124037, 695203247382499, 1953846145104788, 5499007738951265, 15497382092112638, 43730041133838768, 123543251479017624, 349420308346480650, 989331197729926287, 2803987549880679632, 7954801754136643516, 22588177682656061810, 64196693206464704362, 182602247626167595456, 519810600557024631102, 1480861128194939954861, 4221816482427300780248, 12044443063926215431110, 34384587801554518764825, 98224265978459788870334, 280763393653361781368016, 803005280788089719039499, 2297961014175010182842435, 6579667054223271824818656, 18849219573668174296900309, 54025984814403352171497235, 154925886375835094434394656, 444477516152579988690493632, 1275771903865117531546240081, 3663422246487582411592280875, 10524106840202292385038064666, 30245570108032911878026307565, 86958248707082070866817173633, 250107537017240570566638862450, 719622146061494520871767867532, 2071280947106141665300222645805, 5963833107232888979289887036001, 17177477168976649049336573688656, 49492153722200365697500244327120, 142643582912365868431070453522188, 411247294624169601919320808678849, 1186000806353614274634938832801238, 3421325350330837660893825441077818, 9872513203741234000481383610380008, 28495853344793298866705112396327297, 82272175329361242661281743550947904, 237595693924245644593026919789831063, 686333891017737374546044251674032944, 1983082383213264952189196140009025100, 5731281599853301160700477858693984450, 16567835300545840347772146460553159948, 47904936508899609927064415254349569678, 138545617048273347014013129402659125820, 400775318202425479448605897241400483845, 1159584802530155219208530618264361768515, 3355793517691540580943093087366781447204, 9713527861415240156494499964401143702356, 28121970056309302815436638189453327661819, 81432825361384820769551018769391357019260, 235850260812210666454078343821108209296066, 683210392806303964669885966157233623997819, 1979484127577707167035006420931218205084479, 5736239939950578029566858725354180571084963, 16625650452131842697909461919340462940705052]